<fieldset>
    <legend>条件搜索</legend>
    <form action="{:request()->url()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get"
          onsubmit="return false">

        <div class="layui-form-item layui-inline">
            <label class="layui-form-label">时间</label>
            <div class="layui-input-inline">
                <input class="layui-input" data-date-range name="date" placeholder="请选择时间"
                       value="{:input('date','')}">
            </div>
        </div>

        <div class="layui-form-item layui-inline">
            <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
            <!--{if auth("indexExport")}-->
            <button class="layui-btn layui-btn-primary"
                    data-form-export="{:url('indexExport')}?date={:input('date')}"
                    type="button">
                <i class="layui-icon layui-icon-export"></i> 导 出
            </button>
            <!--{/if}-->
        </div>
    </form>

</fieldset>

<script>
    window.form.render();
    require(['excel'], function (excel) {
        excel.bind(function (data) {
            var items = [];
            items.push([
                '时间',
                '城市',
                '对接数',
                '完成数',
                '未完成数目',
                '当天转化率',
                '当月转化率',
            ]);
            data.forEach(function (item) {
                items.push([
                    item.date || '',
                    item.city || '',
                    "" + item.docking_count || '0',
                    "" + item.paint_count || '0',
                    "" + item.un_paint_count || '0',
                    item.day_rate || '',
                    ''
                ]);
            });
            return items;
        }, '信息采集数据');
    });
</script>
